package com.coffee.attachment.service;

import com.coffee.attachment.entity.AttachDocumentEntity;
import com.coffee.attachment.entity.AttachVisualEntity;
import com.coffee.attachment.repository.AttachDocumentRepository;
import com.coffee.attachment.repository.AttachVisualRepository;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
 * @author: songkui
 * @since: 2023/5/12 11:42
 */
@Service
@Slf4j
@AllArgsConstructor
public class MochaAttachmentService {
    private final AttachDocumentRepository attachDocumentRepository;
    private final AttachVisualRepository attachVisualRepository;


    public Long saveDocument(AttachDocumentEntity entity){
        attachDocumentRepository.save(entity);
        return entity.getId();
    }

    public Long saveVisual(AttachVisualEntity entity){
        attachVisualRepository.save(entity);
        return entity.getId();
    }

    public AttachDocumentEntity getDocumentById(Integer documentId){
        return attachDocumentRepository.getById(documentId);
    }

}
